Skip to content

Initial StateRegister implementation.#482

Open
fdxmw wants to merge 2 commits into
UCSBarchlab:developmentfrom
fdxmw:state
Open

Initial StateRegister implementation.#482
fdxmw wants to merge 2 commits into
UCSBarchlab:developmentfrom
fdxmw:state

Conversation

@fdxmw

@fdxmw fdxmw commented May 30, 2026

Copy link
Copy Markdown
Member

A StateRegister is just like a Register, except its bitwidth is defined by an IntEnum, and render_trace displays the IntEnum's name instead of its int value.

This also changes enum_name so it converts unknown int values to string with hex, instead of throwing a ValueError.

A `StateRegister` is just like a `Register`, except its bitwidth is defined by
an `IntEnum`, and `render_trace` displays the `IntEnum`'s name instead of its
`int` value.

This also changes `enum_name` so it converts unknown `int` values to string
with `hex`, instead of throwing a `ValueError`.
@codecov

codecov Bot commented May 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.9%. Comparing base (d116f66) to head (05aae0d).
⚠️ Report is 1 commits behind head on development.

Additional details and impacted files
@@              Coverage Diff              @@
##           development    #482     +/-   ##
=============================================
+ Coverage         91.9%   91.9%   +0.1%     
=============================================
  Files               30      30             
  Lines             7443    7460     +17     
=============================================
+ Hits              6837    6854     +17     
  Misses             606     606             

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fdxmw

fdxmw commented May 31, 2026

Copy link
Copy Markdown
Member Author

@timsherwood Thinking about this more, maybe this feature should be added to Register instead of defining a new subclass? Currently, the subclass doesn't seem to do enough to justify its existence.

When a `Register` is constructed with a `State`, the `Register`'s bitwidth is
determined by the `IntEnum`'s maximum value, and `render_trace` displays
enumeration names instead of hex values.
@fdxmw

fdxmw commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

@timsherwood Thinking about this more, maybe this feature should be added to Register instead of defining a new subclass? Currently, the subclass doesn't seem to do enough to justify its existence.

Okay I pushed another commit that adds a State option to Register's constructor, instead of defining a new subclass. I like this new approach much more. I'll squash and merge this next week if nobody has comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant